package emp.repositorios;

import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.axcessfinancial.domain.repository.BaseRepository;
import emp.entidades.EntUbigeo;
public interface UbigeoRepository extends BaseRepository<EntUbigeo, Long>{

	
	@Query("select a from EntUbigeo a where a.nivel=0 ")
	public List<EntUbigeo> listarDepartamentos();

	@Query("select a from EntUbigeo a where a.nivel=:nivel ")
	public List<EntUbigeo> listarUbigeoNivel(@Param("nivel") String nivel);

	@Query(" select b from EntUbigeo b where b.nivel=(select a.nivel from EntUbigeo a where a.id=:id)")
	public List<EntUbigeo> listarUbigeoNivelPadre(@Param("id") Long id);

}